<?php

class Action{
	
	function newsletter($uid)
	{
		$return = array();
		$email = _GET('email');
		$artist_id = $uid;
		if (empty($email) || empty($uid)) {
			return;
		}
		$data = _model('email_list')->getList("WHERE email='$email' AND artist_id=$artist_id ");
		$name = _model('artist')->read(array('id'=>$artist_id));
		if (!$data AND $name ) {
				if(filter_var($email, FILTER_VALIDATE_EMAIL)){	
				_model('email_list')->create(array('email'=>$email, 'artist_id'=>$artist_id));
				$return['success'] = 1;
				} else {
				$return['success'] = 0;
				}
		} else{
			$return['success'] = 0;
		}
		echo json_encode($return);
	}
	
	
	function solo_exhibition($uid)
	{
		$data = _model('artist')->read(array('id'=>$uid));
				
				echo "<!DOCTYPE html><!-- saved from url=(0021) http://www.google.cn/ --><html lang="."zh"."><head>
					<meta http-equiv="."Content-Type"." content="."text/html; charset=UTF-8".">
					<meta  align="."center"." name="."viewport"." content="."width=200; initial-scale=0.5; maximum-scale=0.5;  user-scalable=no;"."/>
					<meta charset="."utf-8".">
					<title>Introduction</title>
					<style type="."text/css".">
					* {
						color:white;
						font-family: Arial,Helvetica,sans-serif;
					}
					h1 {
						margin:0;
						padding:5px;
					}
					h3 {
						margin:0;
						padding:3px;
						font-weight:normal;
					}
					th, td{
						vertical-align:top;
						padding-top:3px;
					}
					</style>  </head>

						<body>"."<div style="."background-color:transparent".">".
						$data['solo_exhibition'].
						"</div>".
						"</body>".
						"</html>";

		}
		
		function group_exhibition($uid)
		{
			$data = _model('artist')->read(array('id'=>$uid));
		
				echo "<!DOCTYPE html><!-- saved from url=(0021) http://www.google.cn/ --><html lang="."zh"."><head>
					<meta http-equiv="."Content-Type"." content="."text/html; charset=UTF-8".">
					<meta  align="."center"." name="."viewport"." content="."width=200; initial-scale=0.5; maximum-scale=0.5;  user-scalable=no;"."/>
					<meta charset="."utf-8".">
					<title>Introduction</title>
					<style type="."text/css".">
					* {
						color:white;
						font-family: Arial,Helvetica,sans-serif;
					}
					h1 {
						margin:0;
						padding:5px;
					}
					h3 {
						margin:0;
						padding:3px;
						font-weight:normal;
					}
					th, td{
						vertical-align:top;
						padding-top:3px;
					}
					</style>  </head>
						<body>"."<div style="."background-color:transparent".">".
						$data['group_exhibition'].
						"</div>".
						"</body>".
						"</html>";
		}
			
		function more_apps($uid)
		{
				$info = _M('apps')->getList();
				echo '<!DOCTYPE html>
<htm>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
</head>
<body style="background: #191919;font-family: Helvetica, Geneva; margin: 0 auto">
<div style="position: absolute;left:830px;top:30px;"><a target="_blank" href="http://www.artdepot.cn/news/show/id/2570"><img style="width:190px;" src="/new.jpg"></a></br><a target="_blank" href="https://itunes.apple.com/cn/app/yi-shu-cang-ku/id547538664?mt=8"><img style="width:190px;" src="/Artdepot.jpg"></a></div>
	<ul style="width: 920px; clear: both;">';
	foreach ($info as $val) {
	  if ($uid) {
		if	($val['艺术家ID'] == $uid){
			continue;
		} 
	   }
		$des = substr($val['简介'], 0, 20);
		echo <<<EOT
<li style="float: left; width: 50%; list-style: none; padding: 17px 0">
			<img src="/Services/images/cropped_136_148/attachments{$val['图标']}" alt="" style="float: left; width: 136px; height: 148px; padding-right: 15px; border: none;" />
			<h1 style="font-size: 22px; color: #FFF; font-weight: lighter; margin: 0; width: 300px; overflow: hidden;" >{$val['标题']}</h1>
			<h3 style="font-size: 16px; line-height: 46px; color: #878787; font-weight: bolder; margin: 0; width: 300px; overflow: hidden;">$des</h3>
			<h3 style="font-size: 16px; line-height: 46px; color: #878787; font-weight: lighter; margin: 0; width: 300px; overflow: hidden;">{$val['时间']}</h3>
			<a href="{$val['url']}"><img src="/buy.png" style="border: none; margin: 0" alt="" /></a>
		</li>
EOT;

	}
			  echo '</body></html>';
			
		}
	
	
}
?>